home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk13 / fracgen / semi.035 < prev    next >
Text File  |  1995-03-18  |  8KB  |  237 lines

  1.  
  2.                      FRACTAL GENERATOR 1.0
  3.                   Copyright (c)1988 Doug Houck
  4.  
  5.  
  6. DISTRIBUTION NOTICE
  7.  
  8.   This Fractal Generator is freely redistributable, so you may give
  9. copies to your friends, but you may not charge for it (other than a 
  10. modest copying fee).
  11.  
  12. SOURCE CODE
  13.  
  14.   Due to the fact that this program is laced with code that is part
  15. of commercial products (Doug's Math Aquarium, Doug's Color Commander),
  16. the remaining code would be of little value to you except as examples.
  17. So it has been omitted.
  18.  
  19. KUDOS
  20.  
  21.   If you derive excessive pleasure from this program, you may send
  22. your appreciation in the form of a $5 bill to:
  23.  
  24.      Doug Houck
  25.      922 West Uncas Road
  26.      Port Townsend, WA  98368
  27.      USA
  28.  
  29.   If this program blows your power supply, crashes your hard disk, or
  30. fails to perform to your expectations, you may send your bills and 
  31. criticisms to:
  32.  
  33.      Bit Bucket
  34.      Track 81
  35.      Daisy Plains, IO 80286
  36.      No Modem's Land
  37.  
  38.  
  39. BUT WHAT DOES IT DO?
  40.  
  41.   The main idea of this program is very simple.  Take a shape composed
  42. of several line segments, and replace each line segment with a small
  43. copy of the entire shape.  Continue doing this until you reach the
  44. resolution limit of your screen.  For example: (Koch Snowflake)
  45.  
  46.               /\
  47. Seed             /  \
  48.         ____/    \____
  49.  
  50.             __/\__
  51. 1st Generation        \    /
  52.         _/\_/    \_/\_
  53.  
  54.  
  55.   What you have is a self-similar fractal.
  56.  
  57.  
  58. GETTING STARTED
  59.  
  60.     There are a number of fractals stored on disk.  To get at them,
  61. just hit Load, and double-click on a filename.  It will plot automatically.
  62. Hit the Menu button to return to the editing screen.
  63.  
  64.     If you wish edit the shape of a fractal seed, select one of
  65. "Add", "Delete" or "Move" from the edit menu, and manipulate the shape
  66. with the mouse.  TIP: Keep the fractal seed simple.
  67.  
  68.     To draw a new fractal, select Draw in the Fractal menu.
  69.  
  70.     For finer control of the fractal, select Parameters in the Fractal
  71. menu.  See below for more info on Parameters.
  72.  
  73. =================  The Menu options are explained below. ==================
  74.  
  75.    PROJECT
  76.       New        Erase the seed (all points) from the screen.
  77.       Load       Load fractal seed and colors from disk.  
  78.       Save       Save fractal seed to disk.
  79.       Quit       Quits program.
  80.  
  81.    EDIT
  82.       Add        Adds a point in the nearest line segment.
  83.       Move       Moves the nearest point.
  84.       Delete     Deletes nearest point.
  85.  
  86.    FRACTAL
  87.       Draw       Draws fractal using current parameters and options.
  88.       Parameters Displays current parameters, allows editing.
  89.            See below on Parameters
  90.       Detail     Length of the shortest allowed line segment.
  91.                  Make larger (5?) for faster drawing.
  92.       Depth      Maximum amount of times to replace line segment
  93.                  with copy.  Max 70, based on program stack.
  94.  
  95. PARAMETERS
  96.  
  97.     RECURSION LEVELS means the following parameters are applied on
  98.     a level by level (generation) basis, where the first character
  99.     applies to the first generation, the second character applies
  100.     to the second generation...  The parameters for the level are
  101.     used BEFORE the line segment parameters.
  102.  
  103.     LINE SEGMENTS means the following parameters are applied to
  104.     the individual line segments of the seed shape.  The first
  105.     character applies to the first line segment (starting from the
  106.     left), the second character applies to the second line segment...
  107.  
  108.     REPEATING is applied to each string to make it long enough.
  109.     For example:
  110.         f      = 'ffffffffffffffffffff...'
  111.         fr     = 'frfrfrfrfrfrfrfrfrfr...'
  112.         vii    = 'viiviiviiviiviiviivi...'
  113.     If invalid characters are present, it defaults to the first
  114.     character in the 'f/r' (or whatever) specification.    
  115.  
  116.     DIRECTION can be forward (f) or reverse (r).  Reversing a shape
  117.     means to swap end for end.
  118.     It converts __/\ to /\__
  119.  
  120.     FLIP can be either normal (n) or flipped (f).  Flip means to
  121.     flip the shape along the axis formed by the endpoints of the shape.
  122.     It converts __/\ to __
  123.                           \/
  124.  
  125.     Flip and reverse can be combined, ergo
  126.     both convert __/\ to   __
  127.                          \/
  128.  
  129.     VISIBLE can be visible (v) or invisible (i).  It is applied to
  130.     each segment of the shape numbered from left to right (as the
  131.     shape was created).
  132.     For instance, 'viv' converts __/\ to __ \
  133.  
  134.     COLOR controls how often the color register is advanced.
  135.     For example, '001' would not increment the color on the first
  136.     2 levels of recursion, but would advance by 1 on the third level.
  137.  
  138.     EXPERIMENT with each of these controls with depth set to 2 or 3,
  139.     a simple shape, varying one parameter at a time.
  140.  
  141.  
  142. THE MENU BUTTON
  143.  
  144.     Just clicking the Menu button will return you to the editing window
  145. from the plotting window or parameter window.
  146.  
  147. ============================================================================
  148.  
  149.   'Fractal Will Expand' requester - what it means.
  150.  
  151. Imagine a line drawn from one endpoint of your shape to the other.  If any
  152. one of the lines in your shape is bigger than this imaginary line,
  153. the fractal will expand.  The easiest way to fix this is to move your
  154. shape endpoints farther apart, thereby making the component line segments
  155. smaller in comparison.
  156.  
  157.   If you decide to Try It, one of three things may happen.
  158.  
  159.     1.  The line drawing routine tries to draw into a far corner of the
  160.         Amiga's memory.  Corners being what they are, there may be a moron
  161.         program there which is confounded by strange new opcodes.  (Reader
  162.         Problem:  Design a program (a la Core Wars) which can withstand the
  163.         onslaught of a line drawer gone wild.)
  164.  
  165.     2.  You wisely chose a small Depth, and made sure the line segments
  166.         are only marginally larger than the shape endpoint-to-endpoint
  167.         length.  Some wild lines appear on your screen, but nothing blows
  168.         up.
  169.  
  170.     3.  Time is consumed at the following rate:
  171.            Time = (time per line segment)*((number of line segments)^Depth)
  172.         Unless you have a time warp handy, you'd best try a different shape.
  173.  
  174. MORE COMMANDS
  175.  
  176.     If your fractals end up plotting in a corner, you may shift the
  177.     seed by pressing the cursor keys.  Each press moves the seed 10
  178.     pixels.
  179.  
  180.     For ultimate power, you may edit the files in which it saves the 
  181.     seed formulas with any plain ascii editor.  
  182.  
  183. FOR HACKOIDS
  184.  
  185.     You may also enter the seed shapes directly - here's how.
  186.  
  187.     Select load, and load the file "Con:0/0/200/50/input".  It will
  188.     give you some "Drawer not Found"s, but hit OK anyhow.  You have
  189.     just opened the console file on the workbench screen.  Pull
  190.     down the FracGen screen part way, and the plotting screen too to
  191.     expose the "input" window on Workbench.
  192.  
  193.     Now type commands in the "input" window just like they would appear
  194.     in a formula file.  The two most useful commands are:
  195.  
  196.         Point x y        ; Line to this point.
  197.  
  198.         Angle degrees length    ; Turn in this direction, and
  199.                     ; draw a line this long.
  200.                     ; This is relative to your current
  201.                     ; heading, a la Turtle Graphics.
  202.  
  203.     I would suggest a sequence like the following for the Koch Snowflake
  204.  
  205.         Point 100 100        ;     ; define starting point
  206.         Angle 0 75        ; __    ; start pointing thisaway-->
  207.         Angle 60 75        ; __/
  208.         Angle -120 75        ; __/\
  209.         Angle 60 75        ; __/\__
  210.  
  211.     Press <CTRL><\> (control and backslash) to terminate input.
  212.     Center the seed with the cursor keys.
  213.  
  214. SAVING FRACTALS
  215.     Feel free to add your own beautiful fractals to this collection.
  216. Before you save the fractal, select the Parameters window, and enter your
  217. name and some notes about your particular fractal.
  218.  
  219. IMPLEMENTATION
  220.    This was coded in Lattice C, and hacked into Manx C, except for a
  221. custom fixed decimal point multiply in Assembly.  I use the Motorola
  222. Fast Floating Point library for all the shape manipulation, then do all
  223. the fractal drawing with fixed decimal point arithmetic, which cooks 
  224. on multiplication, really flies on addition and conversion to integers.
  225.  
  226.    Actually, the hardest part was the routine to find the nearest line
  227. segment in Add point.  It requires a rotation of axes before the distance
  228. can be determined.  If you have a large number of points (>10) you will
  229. notice a slight delay as it cranks through all the calculations.
  230.                        
  231. REFERENCE
  232.    As usual, I refer you to Benoit B. Mandelbrot's book, The Fractal
  233.    Geometry of Nature, W. H. Freeman and Company, 1977.  Look especially
  234.    around page 43, and at the Koch Snowflake, which inspired this program.
  235.    Also, there are numerous shapes spread around the book.
  236.  
  237.